<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Source')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-source" data-rule="required" class="form-control" name="row[source]" type="text" value="{$row.source|htmlentities}" disabled>
        </div>
    </div>
<!--        <div class="form-group">-->
<!--            <label class="control-label col-xs-12 col-sm-2">{:__('Is_income')}:</label>-->
<!--            <div class="col-xs-12 col-sm-8">-->
<!--                <input id="c-is_income" data-rule="required" class="form-control" name="row[is_income]" type="text" value="{$row.is_income|htmlentities}" disabled>-->
<!--            </div>-->
<!--        </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">总共{:__('Cost')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-cost" data-rule="required" class="form-control" step="0.01" name="allmoney" type="number" value="{$allmoney|htmlentities}" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{if condition="$row['is_income'] == 1 "} 已收入 {else /}已支出 {/if}   :</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-paymoney" data-rule="required" class="form-control" step="0.01" name="row[paymoney]" type="number" value="{$paymoney|htmlentities}" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('对象')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-obj" data-rule="required" class="form-control" step="0.01" name="row[settle_name]" type="text" value="{$row.settle_name|htmlentities}" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">本次支出:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-pay" data-rule="required" class="form-control"  name="pay" type="text" value="0" onkeyup="checkInputIntFloat(this);" >
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">优惠:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-discount" data-rule="required" class="form-control"  name="discount" type="text" value="0"  >
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('制单时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-make_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="make_time" type="text" value="{:date('Y-m-d')}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('过账时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-pay_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="pay_time" type="text" value="{:date('Y-m-d')}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('收/付款方式')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select name="pay_id" id="" class="form-control " >
                {volist name="plist" id="vo"}
                <option value="{$vo.id}">{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="c-thumb" class="control-label col-xs-12 col-sm-2">凭证:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumb" class="form-control" size="50" name="thumb" type="text" value="" />
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-imagethumb" class="btn btn-danger plupload" data-input-id="c-thumb" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/webp" data-multiple="true" data-preview-id="p-thumb"><i class="fa fa-upload"></i>上传</button></span>
                </div>
                <span class="msg-box n-right"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-thumb"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-explain" class="form-control " rows="5" name="remark" cols="50"></textarea>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<!--            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>-->
        </div>
    </div>
</form>
<script>
    function checkInputIntFloat(oInput) {
        oInput.value = oInput.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
        oInput.value = oInput.value.replace(/^\./g,""); //验证第一个字符是数字
        oInput.value = oInput.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
        oInput.value = oInput.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        oInput.value = oInput.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
        if('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/,'')) {
            oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' :oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
        }
    }
</script>